#include<stdio.h>
class Base
{
    public:
        virtual ~Base(){printf("Base destuctor\n");}
};

class Derived:public Base
{
    public:
        Derived();
        ~Derived();
    private:
        int *i_pointer;
};
Derived::Derived()
{
    i_pointer = new int(0);
}

Derived::~Derived()
{
    printf("Derived destructor\n");
    delete i_pointer;
}
void fun(Base *b)
{
    delete b;
}
int main(int argc, char *argv[])
{
    Base *b = new Derived();
    fun(b);
    return 0;
}
